package cn.com.server.controller.userManage;


import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.github.pagehelper.Page;

import cn.com.server.common.AjaxCodeUtil;
import cn.com.server.common.AjaxObject;
import cn.com.server.entity.Group;
import cn.com.server.service.GroupService;
import cn.com.server.extend.model.GroupModel;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

/**
 * <p>
 * 用户组表 前端控制器
 * </p>
 *
 * @author qing
 * @since 2017-11-20
 */
@Controller
@RequestMapping("/userManage/group")
public class GroupController {
	
	@Autowired
	private GroupService groupService;
	
	@RequestMapping("/groupList")
	public String groupList(HttpServletRequest request, HttpServletResponse response) {
		return "/userManager/groupList";
	}
	
	@RequestMapping("/getGroupList")
	@ResponseBody
	public AjaxObject getGroupList(GroupModel model,HttpServletRequest request, HttpServletResponse response,HttpSession session) {
		Page<Group> pageData = groupService.selectGroupList(model);
		AjaxObject ajaxObject = AjaxCodeUtil.getAjaxObject("success");
		ajaxObject.setData(pageData);
		return ajaxObject;
	}
}
